package com.example.plumneedle;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.plumneedle.utils.EditTextClearTools;
import com.zhl.userguideview.UserGuideView;

import java.util.Timer;
import java.util.TimerTask;

public class MainActivity extends AppCompatActivity {
    TextView  textView;
    Button button;
    ImageView imageView;
    ImageView imageView1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        init();
        TitanicTextView tv = (TitanicTextView) findViewById(R.id.tv_title);
        // set fancy typeface
        tv.setTypeface(Typefaces.get(this, "Satisfy-Regular.ttf"));
        // start animation
        new Titanic().start(tv);
        textView=findViewById(R.id.textView);
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(MainActivity.this,Resiter.class);
                startActivity(intent);
            }
        });
        button=findViewById(R.id.btn_login);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                final Timer timer=new Timer();
                timer.schedule(new TimerTask() {
                    @Override
                    public void run() {
                        Intent intent1=new Intent(MainActivity.this,MainInterface.class);
                        startActivity(intent1);
                        timer.cancel();
                    }
                },1000);
            }
        });
        imageView=findViewById(R.id.imageView53);
        imageView1=findViewById(R.id.imageView54);
       /* UserGuideView userGuideView=findViewById(R.id.guideView);
        userGuideView.setHighLightView(imageView,imageView1);
        userGuideView.setArrowUpCenter(R.mipmap.up_arrow);
        userGuideView.setTipView(imageView,400,200);*/
    }
    private void init(){
        EditText userName = (EditText) findViewById(R.id.et_userName);
        EditText password = (EditText) findViewById(R.id.et_password);
        ImageView unameClear = (ImageView) findViewById(R.id.iv_unameClear);
        ImageView pwdClear = (ImageView) findViewById(R.id.iv_pwdClear);

        EditTextClearTools.addClearListener(userName,unameClear);
        EditTextClearTools.addClearListener(password,pwdClear);
    }


}
